using System;
using System.Collections.Generic;
using System.Text;
using BusinessObjects.BO_Actions.ContactUs;
using Entity.StoreProcedure;
using BusinessObjects;
using System.Data;
using BusinessObjects;
namespace BusinessObjects.BO_GetObjects 
{
	public static class BO_ContactUs
	{
		public static DataTable SelectAll(int status)
		{
			try
			{
				BOContactUs_Select_All action = new BOContactUs_Select_All();
				usp_ContactUs_Select_All entity = new usp_ContactUs_Select_All();
				entity.STATUS = status;
				
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectTop(int rows, int status)
		{
			try
			{
				BOContactUs_Select_Top action = new BOContactUs_Select_Top();
				usp_ContactUs_Select_Top entity = new usp_ContactUs_Select_Top();
				entity.NUMBERRECORD = rows;
				entity.STATUS = status;
				
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable Search(int  contact_id)
		{
			try
			{
				BOContactUs_Search action = new BOContactUs_Search();
				usp_ContactUs_Search entity = new usp_ContactUs_Search();
				entity.CONTACT_ID = contact_id;
				
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static DataTable SelectWithPaged(int startIndex, int pageCount, int status)
		{
			try
			{
				BOContactUs_Select_WithPaged action = new BOContactUs_Select_WithPaged ();
				usp_ContactUs_Select_WithPaged entity = new usp_ContactUs_Select_WithPaged ();
				entity.STARTINDEX = startIndex;
				entity.MAXRECORDS = pageCount;
				entity.STATUS = status;
				
				return action.ExecuteAndReturnDataTable(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Insert( string sender_name, string sender_email, string contact_title, string contact_detail, bool is_read, DateTime created_date, bool status)
		{
			try
			{
				BOContactUs_Insert action = new BOContactUs_Insert();
				usp_ContactUs_Insert entity = new usp_ContactUs_Insert();
               entity.SENDER_NAME = sender_name;
               entity.SENDER_EMAIL = sender_email;
               entity.CONTACT_TITLE = contact_title;
               entity.CONTACT_DETAIL = contact_detail;
               entity.IS_READ = is_read;
               entity.CREATED_DATE = created_date;
               entity.STATUS = status;
				
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static string Update( Int64 contact_id, string sender_name, string sender_email, string contact_title, string contact_detail, bool is_read, DateTime created_date, bool status)
		{
			try
			{
				BOContactUs_Update action = new BOContactUs_Update();
				usp_ContactUs_Update entity = new usp_ContactUs_Update();
               entity.CONTACT_ID = contact_id;
               entity.SENDER_NAME = sender_name;
               entity.SENDER_EMAIL = sender_email;
               entity.CONTACT_TITLE = contact_title;
               entity.CONTACT_DETAIL = contact_detail;
               entity.IS_READ = is_read;
               entity.CREATED_DATE = created_date;
               entity.STATUS = status;
				
				return action.ExecuteAndReturnStringValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Delete(int contact_id)
		{
			try
			{
				BOContactUs_Delete action = new BOContactUs_Delete();
				usp_ContactUs_Delete entity = new usp_ContactUs_Delete();
				entity.CONTACT_ID = contact_id;
				
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
		public static bool Restore(int contact_id)
		{
			try
			{
				BOContactUs_Restore action = new BOContactUs_Restore();
				usp_ContactUs_Restore entity = new usp_ContactUs_Restore();
				entity.CONTACT_ID = contact_id;
				
				return action.ExecuteAndReturnBooleanValue(entity);
			}
			catch (Exception ex)
			{
				throw ex;
			}
		}
	}
}

